using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SouthernLand.WebMaster.Tools
{
    public partial class NewsLetter : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // kiem tra xem can hien thi btDelete hay khong
            int Count = Common.BOL.NewsLetter.GetCountNewsLetter();
            if (Count > 0)
                btDelete.Visible = true;
            else
                btDelete.Visible = false;
        }

        protected void btDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in GridViewItem.Rows)
            {
                bool isChecked = ((CheckBox) row.FindControl("chkSelect")).Checked;
                if (isChecked)
                {
                    int NewsLetterID = Convert.ToInt32(((CheckBox) row.FindControl("chkSelect")).ToolTip.Trim());
                    Common.BOL.NewsLetter.Delete(NewsLetterID);
                }
            }

            GridViewItem.DataBind();
        }
    }
}